//
// Created by Xu Xiao on 2022/9/16.
//

#include "Sln_N_Q2560.h"
#include "Sln_T_Q2566.h"
#include "Sln_W_Q2569.h"

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <unordered_map>


#ifndef ALGORITHM_22_1_SOLUTION0923_H
#define ALGORITHM_22_1_SOLUTION0923_H

using namespace std;


class Solution0923 {
public:
    static void S_Q2565() {
        int n;
        while (cin >> n) {
            if (n == 0) break;
            queue<int> qu;
            queue<int> outQ;
            for (int i = 1; i <= n; i++) {
                qu.push(i);
            }
            while (qu.size() > 1) {
                outQ.push(qu.front());
                qu.pop();
                qu.push(qu.front());
                qu.pop();
            }
            cout << "Discarded cards: ";
            while (outQ.size() > 1) {
                cout << outQ.front() << ", ";
                outQ.pop();
            }
            cout << outQ.front() << endl;
            cout << "Remaining card: " << qu.front() << endl;
        }
    }

    static void T_Q2566() {
        Sln_T_Q2566 slnTQ2566;
    }

    static void U_Q2567() {
        int t = 1;
        int n;
        int seq[30];
        memset(seq, 0, sizeof(seq));
        while (scanf("%d", &n) != EOF) {
            bool isASeq = true;
            for (int i = 0; i < n; i++) {
                scanf("%d", &seq[i]);
            }
            for (int i = 0; i < n; i++) {
                if (!isASeq) break;
                for (int j = i + 1; j < n; j++) {
                    int sum = 0;
                    for (int k = i; k <= j - 1; k++) {
                        sum += seq[k];
                    }
                    if (sum == seq[j]) {
                        isASeq = false;
                        break;
                    }
                }
            }
            cout << "Case #" << t << ": ";
            for (int i = 0; i < n; i++) {
                cout << seq[i] << " ";
            }
            cout << "\nThis is " << (isASeq ? "" : "not ") << "an A-sequence.\n";
            t++;
        }
    }

    static void W_Q2569() {
        Sln_W_Q2569 slnW2569;
    }
};


#endif //ALGORITHM_22_1_SOLUTION0923_H
